/*
 * gameWinnerDialog.java
 *
 * Created on 28/05/2011, 01:58:37
 */
package src.ui.guiComponents.dialogs;

/**
 * public class gameWinnerDialog extends javax.swing.JDialog 
 * public
 * opens a game over dialog which states the game winner and lets the player exit
 * @author Shachar Butnero and Omer Shenhar
 */
public class gameWinnerDialog extends javax.swing.JDialog {

   
     
   /**
     * Creates new form gameWinnerDialog 
     * @param parent- the owner frame for super
     * @param modal- is modal
     * @param winMessage - a proper message stating the winner
     */ 
    public gameWinnerDialog(java.awt.Frame parent, boolean modal, String winMessage) {
        super(parent, modal);
        initComponents();
        this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        winnerAnnouncement.setText(winMessage);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        winnerAnnouncement = new javax.swing.JLabel();
        leaveButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        winnerAnnouncement.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        winnerAnnouncement.setForeground(new java.awt.Color(255, 0, 0));
        winnerAnnouncement.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        winnerAnnouncement.setText("Player abcdefghij is the undisputed winner! Heap-heap-array!");
        winnerAnnouncement.setFocusable(false);
        winnerAnnouncement.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        leaveButton.setText("Exit");
        leaveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                leaveButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(leaveButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(winnerAnnouncement, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(winnerAnnouncement)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(leaveButton, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void leaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leaveButtonActionPerformed
        System.exit(0);
    }//GEN-LAST:event_leaveButtonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton leaveButton;
    private javax.swing.JLabel winnerAnnouncement;
    // End of variables declaration//GEN-END:variables
}
